package com.neo.scalaCookBook.C1_String

/**
  * Autuor : zhaoshun
  * Time   : 2017/10/17 22:07
  * Email  : tmby1314@163.com  
  */

/**
  * 传递一个函数
  */
object UnderstandingMap {

  /**
    *
    * @param args
    */
  def main(args: Array[String]): Unit = {
    val result1 = "HELLO".map(c => (c.toByte+32).toChar)
    println(result1)
    val result2 = "HELLO".map{c => (c.toByte+32).toChar}
    println(result2)

    val result3 = "HELLO".map(toLower)
    println(result3)

    val s = "HELLO"
    for(c <- s) yield toLower(c)
  }

  def toLower(c: Char): Char = (c.toByte+32).toChar

}
